package tinycloud.gui.dialog;

import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Panel;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import tinycloud.gui.action.CloseAboutDialogAction;

/**
 * Boite de dialogue à propos.
 * @author Nicolas CHARREL
 */
public class AboutDialog extends JDialog{

    private JPanel mainPanel;
    private JLabel nameLabel;
    private JLabel authorLabel;
    private JLabel websiteLabel;
    private JPanel buttonPanel;
    private JButton closeButton;
    
    public AboutDialog() {
        super();
        setTitle("À propos");
        setResizable(false);

        mainPanel = new JPanel();
        mainPanel.setLayout(new GridLayout(4, 1));

        nameLabel = new JLabel("Tiny Cloud 0.2", JLabel.CENTER);
        nameLabel.setFont(new Font("Arial", Font.BOLD, 30));
        mainPanel.add(nameLabel, Panel.CENTER_ALIGNMENT);

        authorLabel = new JLabel("Auteur: Nicolas Charrel", JLabel.CENTER);
        mainPanel.add(authorLabel);

        websiteLabel = new JLabel("Site web: http://charrel.fr", JLabel.CENTER);
        mainPanel.add(websiteLabel);

        closeButton = new JButton("Fermer");
        closeButton.addActionListener(new CloseAboutDialogAction(this));
        buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
        buttonPanel.add(closeButton);
        mainPanel.add(buttonPanel);
        
        setContentPane(mainPanel);
        pack();
        setVisible(true);
    }
}
